package com.time.timespace.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.time.timespace.commons.constant.BaseConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "支出表")
@TableName("ts_charge")
public class Charge {

    @Schema(description = "表id")
    @TableId(value = "charge_id", type = IdType.AUTO)
    private Long chargeId;

    @Schema(description = "流水号")
    private String chargeNum;

    @Schema(description = "日期")
    @DateTimeFormat(pattern = BaseConstants.Pattern.DATE)
    @JsonFormat(pattern = BaseConstants.Pattern.DATE)
    private Date date;

    @Schema(description = "金额")
    private BigDecimal amount;

    @Schema(description = "分类")
    private String category;

    @Schema(description = "备注")
    private String remarks;

    @Schema(description = "创建人")
    private String createdBy;

    @Schema(description = "删除标识，Y表示删除，N表示未删除")
    private String deleteFlag;

    @Schema(description = "in代表收入，out代表支出")
    private String type;

    @Schema(description = "创建日期")
    @DateTimeFormat(pattern = BaseConstants.Pattern.DATE_TIME)
    @JsonFormat(pattern = BaseConstants.Pattern.DATE_TIME)
    private Date creationDate;

    @TableField(exist = false)
    private String dateStr;
    @TableField(exist = false)
    private String monthStr;
    @TableField(exist = false)
    private String yearStr;
}
